<template>
	<div id="register">
		<div id="form">
			<div id="topFlag">
				<span class="blue"></span>
				<span class="white"></span>
				<span class="blue"></span>
				<span class="white"></span>
				<span class="blue"></span>
			</div>
			<div id="content">
				<div class="input">
					<van-icon name="phone-o" size="25"/>
					<input type="text" placeholder="请输入手机号码" :value="user.phone">
				</div>
				<div class="input">
					<van-icon name="certificate" size="25"/>
					<input type="text" placeholder="请输入身份证号" :value="user.identify">
				</div>
				<div class="input">
					<van-icon name="notes-o" size="25"/>
					<input type="text" placeholder="请输入用户昵称" :value="user.nickname">
				</div>
				<div class="input">
					<van-icon name="lock" size="25"/>
					<input type="password" placeholder="请输入密码" :value="user.password">
				</div>
				<div class="input">
					<van-icon name="lock" size="25"/>
					<input type="password" placeholder="请确认密码" :value="user.checkPass">
				</div>
				<div class="input">
					<van-button type="primary" round @click="toRegister()">注册</van-button>
				</div>
			</div>
		</div>
		<div>
			<div id="or">
				<p >OR</p>
			</div>
			<div style="display: flex; justify-content: center;">
				<van-button plain type="primary" round style="width: 80%;" @click="this.$router.push({path: '/login'})">已有账号，去登录</van-button>
			</div>
		</div>
	</div>
</template>

<script>
	import { showToast,showSuccessToast, showFailToast } from 'vant';
	export default{
		data(){
			return{
				user:{
					phone:'',
					identify:'',
					nickname:'',
					password:'',
					checkPass:'',
				}
			}
		},
		methods:{
			toRegister(){
				if(this.user.phone.trim().length == 0 || this.user.identify.trim().length == 0 ||
				this.user.nickname.trim().length == 0 || this.user.password.trim().length == 0){
					showToast('信息填写有误！'); return;
				}
				if(this.user.password != this.user.checkPass){
					showFailToast('两次ima不一致');
				}
			}
		}
	}
</script>

<style scoped>
	@import "../../assets/css/register.css";
</style>